package com.chuanyang.driverh.mainorder.adapter;


import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.chuanyang.driverh.R;
import com.chuanyang.driverh.base.BaseListAdapter;
import com.chuanyang.driverh.responseresult.LookWaybillDetailData;

import java.util.List;

public class LookGoodAdapter extends BaseListAdapter<LookWaybillDetailData.DataBean> {
    private Context context;
    private List<LookWaybillDetailData.DataBean> list;
    private ViewHolder viewHolder;

    public LookGoodAdapter(Context context, List<LookWaybillDetailData.DataBean> list) {
        super(context,list);
        this.list=list;
        this.context=context;
    }

    @Override
    public View getZkView(int position, View convertView, ViewGroup parent) {
        if(convertView==null)
        {
            convertView= View.inflate(getContext(), R.layout.order_item_lookgood,null);
            viewHolder = new ViewHolder();
            viewHolder.tv_lookgoood_name= (TextView) convertView.findViewById(R.id.tv_lookgoood_name);
            viewHolder.tv_lookgoood_standard= (TextView) convertView.findViewById(R.id.tv_lookgoood_standard);
            viewHolder.tv_lookgoood_weight= (TextView) convertView.findViewById(R.id.tv_lookgoood_weight);
            viewHolder.tv_lookgoood_num= (TextView) convertView.findViewById(R.id.tv_lookgoood_num);
            convertView.setTag(viewHolder);
        }
        else
        {
            viewHolder= (ViewHolder) convertView.getTag();
        }
        LookWaybillDetailData.DataBean  bean=getItem(position);
        viewHolder.tv_lookgoood_name.setText(bean.getGoodsName());
        viewHolder.tv_lookgoood_standard.setText(bean.getGoodsStandard());
        viewHolder.tv_lookgoood_weight.setText(bean.getDetailsWeight()+"t");
        if(bean.getDetailsNum()!=null) {
            viewHolder.tv_lookgoood_num.setText(bean.getDetailsNum() +"");
        }
        else {
            viewHolder.tv_lookgoood_num.setText("---");
        }
        return convertView;
    }
    class ViewHolder{
        private TextView tv_lookgoood_name;
        private TextView tv_lookgoood_standard;
        private TextView tv_lookgoood_weight;
        private TextView tv_lookgoood_num;
    }

}
